import http from "@/utils/http";

export const getPageApi = (queryPageParams) => {
  return http({
    url: "sys/sysRole/getPage",
    method: "GET",
    params:queryPageParams
  }
  )
};

export const saveApi = (form) => {
  return http({
    url: "sys/sysRole/save",
    method:"Put",
    data:form
  }
  )
};

export const getByIdApi = (id) => {
  return http({
    url: "sys/sysRole/getById",
    method:"GET",
    params:{
      id
    }
  }
  )
};

export const updateApi = (form) => {
  return http({
    url: "sys/sysRole/update",
    method:"POST",
    data: form
  }
  )
};


export const delApi = (ids) => {
  console.log(ids)
  return http({
    url: "sys/sysRole/del?ids="+ids,
    method: "DELETE"
  })
}

export const getAllMenuTreeApi = () => {
  return http({
    url: "sys/sysRole/getAllMenuTree",
    method: "GET"
  }
  )
};



export const getMenuIdByIdApi = (roleId) => {
  return http({
    url: "sys/sysRole/getMenuIdById",
    method: "GET",
    params:{
      roleId
    }
  }
  )
};


export const updateMenuApi = (roleId,menuIdList) => {
  return http({
    url: "sys/sysRole/updateMenu?roleId="+roleId+"&menuIdList="+menuIdList,
    method:"POST"
  }
  )
};
